package com.shuiyun.jtt.handler;

import io.netty.buffer.Unpooled;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;

/**
 * @author shuiyun
 * @description 解码器 解决黏包和半包问题
 * @date 2022-04-18 23:39
 */
public class FrameDecoder extends DelimiterBasedFrameDecoder {

    private final static byte[] DELIMITER = new byte[]{0x7e};

    public FrameDecoder() {
        this(4096, DELIMITER);
    }

    public FrameDecoder(int maxFrameLength, byte[] bytes) {
        super(maxFrameLength, Unpooled.wrappedBuffer(bytes), Unpooled.wrappedBuffer(bytes, bytes));
    }
}
